const Mock = require("mockjs");

// 获取所有球队
Mock.mock("http://xx.com/team/team_list", "get", () => {
  let list = [];
  for (let i = 1; i <= 30; i++) {
    list.push({
      id: i,
      name: `Tor__${i}_`,
    });
  }
  return {
    error_code: 0,
    data: {
      team_list: list,
      count: 30,
    },
  };
});

// 获取历史最佳球队
Mock.mock("http://xx.com/team/best_team", "get", () => {
  return {
    error_code: 0,
    data: {
      win_rank: {
        name: "GSW",
        count: 20,
      },
      score_rank: {
        name: "GSW",
        count: 20,
      },
      home_win_rank: {
        name: "GSW",
        count: 20,
      },
      lose_rank: {
        name: "GSW",
        count: 20,
      },
      away_win_rank: {
        name: "GSW",
        count: 20,
      },
    },
  };
});

// 获取所有球队历史数据
Mock.mock("http://xx.com/history/teams_data", "get", () => {
  let list = [];
  for (let i = 1; i <= 30; i++) {
    list.push({
      name: `SAS_${i}`,
      total_win: 2000,
      average_win: 49.69,
      average_score: 101.2,
      average_win_rate: 0.53,
    });
  }
  return {
    error_code: 0,
    data: {
      team_list: list,
      count: 30,
    },
  };
});

// 球队前6年历史数据
Mock.mock(/http:\/\/xx.com\/team\/history/, "get", () => {
  let history_list = [];
  for (let i = 1; i <= 6; i++) {
    history_list.push({
      year: 2020 - i,
      score: 45 + i * 10,
      win: 20 - i * 10,
      shot: 5,
      assist: 1,
      three_point: 1,
      cap: 5,
      backboard: 5,
      foul: 110 - i * 2,
      steal: 9,
    });
  }
  return {
    error_code: 0,
    data: {
      history_list: history_list,
      count: 10,
    },
  };
});

Mock.mock(/http:\/\/xx.com\/team\/player_salary/, "get", () => {
  return {
    error_code: 0,
    data: {
      player_list: [
        {
          name: "Kaly",
          salary: 100000,
          score: 100,
          percent: 0.9,
        },
        {
          name: "Kaly",
          salary: 90000,
          score: 90,
          percent: 0.9,
        },
        {
          name: "Kaly",
          salary: 120000,
          score: 10,
          percent: 0.9,
        },
        {
          name: "Kaly",
          salary: 100000,
          score: 200,
          percent: 0.9,
        },
        {
          name: "Kaly",
          salary: 60000,
          score: 50,
          percent: 1,
        },
        {
          name: "Kaly",
          salary: 70000,
          score: 100,
          percent: 1,
        },
      ],
      count: 6,
    },
  };
});

// 球队聚合分析
// Mock.mock(/http:\/\/xx.com\/team\/group_data/, "get", () => {
//   return {
//     error_code: 0,
//     data: {
//       average_win: 49.69,
//       average_score: 101.2,
//       average_win_rate: 0.53,
//     },
//   };
// });

// 获取所有球员
Mock.mock("http://xx.com/player/player_list", "get", () => {
  let list = [];
  for (let i = 1; i <= 30; i++) {
    list.push({
      id: i,
      name: `jassica__${i}_`,
    });
  }
  return {
    error_code: 0,
    data: {
      player_list: list,
      count: 30,
    },
  };
});

// 赛季最佳球员
Mock.mock(/http:\/\/xx.com\/season\/best_player\?/, "get", () => {
  return {
    error_code: 0,
    data: {
      mvp: {
        name: "Jarnell Stokes",
        count: 1,
      },
      score: {
        id: 1,
        name: "name_1",
        count: 1,
      },
      backboard: {
        id: 2,
        name: "name_2",
        count: 10,
      },
      three_point: {
        id: 3,
        name: "name_3",
        count: 12,
      },
      assist: {
        id: 4,
        name: "name_4",
        count: 100,
      },
    },
  };
});

// 获取赛季最佳球员排行前六名
Mock.mock(/http:\/\/xx.com\/season\/best_player_rank/, "get", () => {
  return {
    error_code: 0,
    data: {
      player_list: [
        {
          name: "James Harden",
          per: 40,
          attack: 100,
          defence: 60,
          ws: 120,
          rank: 1,
        },
        {
          name: "James Harden",
          per: 50,
          attack: 200,
          defence: 50,
          ws: 160,
          rank: 2,
        },
        {
          name: "James Harden",
          per: 60,
          attack: 150,
          defence: 70,
          ws: 230,
          rank: 3,
        },
        {
          name: "James Harden",
          per: 70,
          attack: 200,
          defence: 80,
          ws: 240,
          rank: 4,
        },
        {
          name: "James Harden",
          per: 80,
          attack: 100,
          defence: 40,
          ws: 200,
          rank: 5,
        },
        {
          name: "James Harden",
          per: 100,
          attack: 60,
          defence: 30,
          ws: 100,
          rank: 6,
        },
      ],
    },
  };
});

// 获取季后赛最激烈队伍TOP10
Mock.mock(/http:\/\/xx.com\/season\/playoff_team_top/, "get", () => {
  let list = [];
  for (let i = 1; i <= 10; i++) {
    list.push({
      id: i,
      name: `TOR__${i}_`,
      win_los_diff: i,
    });
  }
  return {
    error_code: 0,
    data: {
      team_list: list,
      count: 10,
    },
  };
});

// 获取赛季最佳队伍TOP6
Mock.mock(/http:\/\/xx.com\/season\/team_rank/, "get", () => {
  let list = [];
  for (let i = 1; i <= 6; i++) {
    list.push({
      name: "TOR_" + i,
      win: 50 * i,
      score: 10 * i,
      cap: 20 * i,
      los: 30 * i,
    });
  }
  return {
    error_code: 0,
    data: {
      team_list: list,
      count: 6,
    },
  };
});

// 球员个人历史数据
Mock.mock(/http:\/\/xx.com\/player\/history_agg/, "get", () => {
  return {
    error_code: 0,
    data: {
      backboard_hit: 0.68,
      near_hit: 0.4,
      middle_hit: 0.36,
      long_hit: 0.3,
      penalty_hit: 0.8,
      three_point_hit: 0.6,
      real_hit: 0.48,
      backboard: 20,
      assist: 20,
      mistake: 20,
      score: 20,
      cap: 20,
      steal: 20,
    },
  };
});

// 球员各个赛季数据
Mock.mock(/http:\/\/xx.com\/player\/season/, "get", () => {
  return {
    error_code: 0,
    data: {
      backboard_hit: 0.68,
      near_hit: 0.4,
      middle_hit: 0.36,
      long_hit: 0.3,
      penalty_hit: 0.8,
      three_point_hit: 0.3,
      real_hit: 0.3,
      backboard: 60,
      assist: 90,
      mistake: 40,
      score: 20,
      cap: 3,
      steal: 10,
    },
  };
});

// 获取球员前6年历史数据
Mock.mock(/http:\/\/xx.com\/player\/history/, "get", () => {
  return {
    error_code: 0,
    data: {
      year_list: [
        {
          year: "16-17",
          per: 20.1,
          shot_rate: 0.6,
        },
        {
          year: "17-18",
          per: 30,
          shot_rate: 0.7,
        },
        {
          year: "18-19",
          per: 40.1,
          shot_rate: 0.8,
        },
        {
          year: "20-21",
          per: 20,
          shot_rate: 0.9,
        },
        {
          year: "21-22",
          per: 30.1,
          shot_rate: 0.5,
        },
        {
          year: "22-23",
          per: 20,
          shot_rate: 0.6,
        },
      ],
    },
  };
});

// 球员聚合分析
// Mock.mock("http://xx.com/player/group_data", "get", () => {
//   return {
//     error_code: 0,
//     data: {
//       mvp: {
//         id: 1,
//         name: "Gustavo Ayon",
//       },
//       score: {
//         id: 2,
//         name: "Gustavo Ayon",
//       },
//       three_point: {
//         id: 3,
//         name: "Gustavo Ayon",
//       },
//     },
//   };
// });

// 获取所有赛季
Mock.mock("http://xx.com/season/season_list", "get", () => {
  let list = [];
  for (let i = 1; i <= 10; i++) {
    list.push({
      id: i,
      name: 2020 - i - 1 + "-" + (2020 - i),
    });
  }
  return {
    error_code: 0,
    data: {
      season_list: list,
      count: 10,
    },
  };
});
